﻿@model EGEHaina.Areas.People.Models.RequiredDocument
<script type="text/javascript">
    $(document).ready(function () {
        if ($.fn.customFileInput) {
            $("input[type='file']").customFileInput();
        }
    });
    com.as.RequiredDocument.prototype.dialogButtons = {
        Create: function () {
            $.ajax({
                url: "/people/requireddocument/createsave",
                type: "POST",
                dataType: 'json',
                data: $('#mws-validate').serialize(),
                beforeSend: function (XMLHttpRequest) {
                    validator.form();
                    if (!validator.valid()) {
                        return false;
                    }
                    dialogForm.dialog('close');
                    com.as.RequiredDocument.prototype.processingDisplay(true);
                    return true;
                },
                success: function (data, textStatus, XMLHttpRequest) {
                    if (textStatus == 'success') {
                        if (data.success) {
                            table.fnDraw();
                            alert.show(data.message);
                        } else {
                            alert.show(data.message, { header: com.as.Alert.FAILURE });
                        }
                    }
                },
                complete: function (jqXHR, textStatus) {
                    com.as.RequiredDocument.prototype.processingDisplay(false);
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    dialogForm.dialog('close');
                    alert.show(errorThrown, { header: com.as.Alert.ERROR });
                }
            });
        },
        "Cancel": function () {
            $(this).dialog("close");
        }
    };
</script>

<div class="mws-panel grid_4">
    <div class="mws-panel-header">
        <span class="mws-i-24 i-alert">Create Required Document</span>
    </div>
    <div class="mws-panel-body">
        <div class="mws-panel-content">
            <div id="mws-form-dialog" title="Create Required Document">
                @using(Html.BeginForm("CreateSave", "RequiredDocument", FormMethod.Post, new { @class = "mws-form", @id="mws-validate" })) {
                    <div id="mws-validate-error" class="mws-form-message error" style="display:none;"></div>
                    <div class="mws-form-inline">
                        <div class="mws-form-row">
                            @Html.LabelFor(model => model.Name)
                            <div class="mws-form-item large">
                                @Html.TextBoxFor(model => model.Name, new { @class = "mws-textinput required" })
                            </div>
                        </div>
                        <div class="mws-form-row">
                            @Html.LabelFor(model => model.CompanyTypeId, "Company Type")
                            <div class="mws-form-item large">
                                @Html.DropDownList("CompanyTypeId", ViewBag.CompanyTypes as SelectList, "Please Select Company Type",new { @class = "required" })
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label>Description</label>
                            <div class="mws-form-item large">
                                @Html.TextAreaFor(model => model.Description, new { @rows = "100%", @cols = "100%"})
                            </div>
                        </div>
                    </div>
                }
            </div>
        </div>
    </div>    	
</div>